	Concentre.Factory.i18n = {
		_detectedLanguage : (navigator.appName =='Netscape'?navigator.language:navigator.browserLanguage).substring(0,2),
		_availableLanguages : {'fr':'franÁais','en':'English','es':'EspaÒol',
	   						   'de':'Deutch', 'it': 'Italian', 'pt-br' : 'Brazilian Portuguese',
							   'ro':'Romamian', 'ru' : 'Russian', 'sw':'Swedish' },
		_defaultLanguage : 'en',
		_xliff : null,
		_messages : {},	
		_regex : new RegExp(/%s/g),
	
		getlanguage : function() {
    		return this._availableLanguages[this._detectedLanguage]?this._detectedLanguage:this._defaultLanguage;
		},
	
	   /**
  		* Load XLiff resource file
  		* @param {string} XLiff source file uri
  		*/
		load : function (src) {
			this._xliff = Concentre.Factory.Xml.loadURL(src);
		},

   	   /**
		* Return translated String
 		* @param {string} XLiff @resname attribute
  		* @param {array} Replace all %s by array values
 		* @type String
 		* @return Translated string 
  		*/
		translate : function (res, attrs)	{
			if (!this._xliff) return res;
			if (typeof(attrs)=='string') attrs = [ attrs ];
			if (!this._messages[res]) {
				
				var expr = new XPath("/xliff/file/body/trans-unit[@resname='"+res+"']/source/text()");
				this._messages[res] = expr(this._xliff.documentElement);
			}
		
			return this._messages[res].replace(this._regex, this.callback.bind(this));

		},
		
		callback: function() {
			return attrs[this._regex.lastIndex];
		}
	};
